home *** CD-ROM | disk | FTP | other *** search
/ PC Users 8 / Cd Pc Users extra 8.iso / prog / inst / ipack / ipack.exe / NEWS.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-11-17  |  23.5 KB  |  736 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Mabry News"
  4.    ClientHeight    =   8025
  5.    ClientLeft      =   1560
  6.    ClientTop       =   1905
  7.    ClientWidth     =   9990
  8.    Height          =   8715
  9.    Left            =   1500
  10.    LinkTopic       =   "Form1"
  11.    LockControls    =   -1  'True
  12.    ScaleHeight     =   535
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   666
  15.    Top             =   1275
  16.    Width           =   10110
  17.    Begin VB.CommandButton cmdCancelMsg 
  18.       Caption         =   "Cancel Msg"
  19.       Height          =   360
  20.       Left            =   6330
  21.       TabIndex        =   14
  22.       Top             =   135
  23.       Width           =   1035
  24.    End
  25.    Begin VB.CheckBox Flag 
  26.       Caption         =   "Flag"
  27.       Height          =   285
  28.       Left            =   9675
  29.       TabIndex        =   13
  30.       Top             =   240
  31.       Visible         =   0   'False
  32.       Width           =   750
  33.    End
  34.    Begin VB.CommandButton cmdReply 
  35.       Caption         =   "Reply"
  36.       Height          =   360
  37.       Left            =   5280
  38.       TabIndex        =   12
  39.       Top             =   135
  40.       Width           =   1050
  41.    End
  42.    Begin VB.CommandButton cmdNewArticle 
  43.       Caption         =   "New Article"
  44.       Height          =   360
  45.       Left            =   4230
  46.       TabIndex        =   11
  47.       Top             =   135
  48.       Width           =   1050
  49.    End
  50.    Begin VB.CheckBox Check2 
  51.       Caption         =   "Trace"
  52.       Height          =   195
  53.       Left            =   8520
  54.       TabIndex        =   10
  55.       Top             =   315
  56.       Width           =   795
  57.    End
  58.    Begin VB.CommandButton cmdVSplit 
  59.       Appearance      =   0  'Flat
  60.       BackColor       =   &H80000005&
  61.       Height          =   2880
  62.       Left            =   4395
  63.       MousePointer    =   9  'Size W E
  64.       TabIndex        =   9
  65.       TabStop         =   0   'False
  66.       Top             =   600
  67.       Width           =   90
  68.    End
  69.    Begin VB.CommandButton cmdHSplit 
  70.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  71.          Name            =   "Arial"
  72.          Size            =   1.5
  73.          Charset         =   0
  74.          Weight          =   400
  75.          Underline       =   0   'False
  76.          Italic          =   0   'False
  77.          Strikethrough   =   0   'False
  78.       EndProperty
  79.       Height          =   90
  80.       Left            =   0
  81.       MousePointer    =   7  'Size N S
  82.       TabIndex        =   8
  83.       Top             =   3480
  84.       Width           =   9765
  85.    End
  86.    Begin VB.TextBox Text1 
  87.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  88.          Name            =   "Courier New"
  89.          Size            =   11.25
  90.          Charset         =   0
  91.          Weight          =   400
  92.          Underline       =   0   'False
  93.          Italic          =   0   'False
  94.          Strikethrough   =   0   'False
  95.       EndProperty
  96.       Height          =   4230
  97.       Left            =   30
  98.       Locked          =   -1  'True
  99.       MultiLine       =   -1  'True
  100.       ScrollBars      =   3  'Both
  101.       TabIndex        =   7
  102.       Top             =   3570
  103.       Width           =   9690
  104.    End
  105.    Begin VB.ListBox listArticles 
  106.       Height          =   2775
  107.       IntegralHeight  =   0   'False
  108.       ItemData        =   "NEWS.frx":0000
  109.       Left            =   4440
  110.       List            =   "NEWS.frx":0002
  111.       TabIndex        =   6
  112.       Top             =   660
  113.       Width           =   5235
  114.    End
  115.    Begin VB.CommandButton cmdGetNewGroups 
  116.       Caption         =   "New Groups"
  117.       Height          =   360
  118.       Left            =   2130
  119.       TabIndex        =   5
  120.       Top             =   135
  121.       Width           =   1050
  122.    End
  123.    Begin VB.ListBox listGroups 
  124.       Height          =   2775
  125.       IntegralHeight  =   0   'False
  126.       Left            =   30
  127.       TabIndex        =   4
  128.       Top             =   660
  129.       Width           =   4335
  130.    End
  131.    Begin VB.CommandButton cmdGetAllGroups 
  132.       Caption         =   "All Groups"
  133.       Height          =   360
  134.       Left            =   3180
  135.       TabIndex        =   3
  136.       Top             =   135
  137.       Width           =   1050
  138.    End
  139.    Begin VB.CheckBox Check1 
  140.       Caption         =   "Blocking"
  141.       Height          =   195
  142.       Left            =   8520
  143.       TabIndex        =   2
  144.       Top             =   105
  145.       Width           =   960
  146.    End
  147.    Begin VB.CommandButton cmdDisconnect 
  148.       Caption         =   "Disconnect"
  149.       Height          =   360
  150.       Left            =   1080
  151.       TabIndex        =   1
  152.       Top             =   135
  153.       Width           =   1050
  154.    End
  155.    Begin VB.CommandButton cmdConnect 
  156.       Caption         =   "Connect"
  157.       Height          =   360
  158.       Left            =   30
  159.       TabIndex        =   0
  160.       Top             =   135
  161.       Width           =   1050
  162.    End
  163.    Begin NewsLib.News News1 
  164.       Left            =   7560
  165.       Top             =   120
  166.       _Version        =   327680
  167.       _ExtentX        =   847
  168.       _ExtentY        =   847
  169.       _StockProps     =   0
  170.       Debug           =   1
  171.       Blocking        =   -1  'True
  172.       Timeout         =   0
  173.    End
  174.    Begin VB.Line Line3 
  175.       BorderColor     =   &H00FFFFFF&
  176.       X1              =   0
  177.       X2              =   911
  178.       Y1              =   0
  179.       Y2              =   0
  180.    End
  181.    Begin VB.Line Line2 
  182.       BorderColor     =   &H00FFFFFF&
  183.       X1              =   -4
  184.       X2              =   907
  185.       Y1              =   39
  186.       Y2              =   39
  187.    End
  188.    Begin VB.Line Line1 
  189.       BorderColor     =   &H00808080&
  190.       X1              =   0
  191.       X2              =   658
  192.       Y1              =   38
  193.       Y2              =   38
  194.    End
  195.    Begin VB.Menu FileMenu 
  196.       Caption         =   "&File"
  197.       Begin VB.Menu FileExit 
  198.          Caption         =   "E&xit"
  199.       End
  200.    End
  201.    Begin VB.Menu SettingsMenu 
  202.       Caption         =   "&Settings"
  203.       Begin VB.Menu SettingsUser 
  204.          Caption         =   "&User..."
  205.       End
  206.       Begin VB.Menu SettingsConnection 
  207.          Caption         =   "&Connection..."
  208.       End
  209.    End
  210.    Begin VB.Menu ShowMenu 
  211.       Caption         =   "Sh&ow"
  212.       Begin VB.Menu ShowHeaders 
  213.          Caption         =   "&Headers"
  214.       End
  215.    End
  216. Attribute VB_Name = "Form1"
  217. Attribute VB_Creatable = False
  218. Attribute VB_Exposed = False
  219. ' Sample program for Mabry News Control
  220. ' This sample shows both blocking and non-blocking use of
  221. ' the Mabry News control.  Please note that this sample does
  222. ' not trap errors returned by the control (connection failure,
  223. ' for instance).  If an error is returned you'll see the usual VB
  224. ' error message box.
  225. ' Zane Thomas/May 96
  226. Option Explicit
  227. ' state is used in non-blocking mode to determine what to do
  228. ' when the Done and DataReady events are fired
  229. Dim state As Integer
  230. Private Const StateDisconnected = 0
  231. Private Const StateGetGroups = 1
  232. Private Const StateSelectGroup = 2
  233. Private Const StateGetArticleIDs = 3
  234. Private Const StateGetArticle = 4
  235. Private Const StateGetHeader = 5
  236. Private Const StateXOver = 6
  237. Const StateConnecting = 7
  238. Const StateConnected = 8
  239. Const StateDisconnecting = 9
  240. ' For spacing during Form_Resize
  241. Private Const Margin = 2
  242. ' Used during article and group retrieval, see AddArticleIDsToList
  243. ' and Add GroupsToList for details
  244. Dim articleIndex As Integer
  245. Dim groupIndex As Integer
  246. ' Properties accessed by setup forms
  247. Private m_emailaddr As String
  248. Private m_logonname As String
  249. Private m_logonpass As String
  250. Public Property Let EmailAddr(s As String)
  251.     m_emailaddr = s
  252. End Property
  253. Public Property Get EmailAddr() As String
  254.     EmailAddr = m_emailaddr
  255. End Property
  256. Public Property Let LogonName(s As String)
  257.     m_logonname = s
  258. End Property
  259. Public Property Get LogonName() As String
  260.     LogonName = m_logonname
  261. End Property
  262. Public Property Let LogonPass(s As String)
  263.     m_logonpass = s
  264. End Property
  265. Public Property Get LogonPass() As String
  266.     LogonPass = m_logonpass
  267. End Property
  268. '''''''''''''''''''''''''''''''''''''''''''''''''''
  269. '  Command Buttons
  270. '''''''''''''''''''''''''''''''''''''''''''''''''''
  271. Private Sub cmdConnect_Click()
  272.     News1.LogonName = Me.LogonName
  273.     News1.LogonPassword = Me.LogonPass
  274.     listGroups.Clear
  275.     listArticles.Clear
  276.     Text1.Text = ""
  277.     If (Check1.Value = 1) Then
  278.         News1.Blocking = True
  279.     Else
  280.         News1.Blocking = False
  281.     End If
  282.     EnableControls False
  283.     state = StateConnecting
  284.     News1.Action = NewsConnect
  285.     If (News1.Blocking) Then
  286.         News1_Done 0
  287.     End If
  288. End Sub
  289. Private Sub cmdDisconnect_Click()
  290.     EnableControls False
  291.     state = StateDisconnecting
  292.     News1.Action = NewsDisconnect
  293.     listGroups.Clear
  294.     listArticles.Clear
  295.     Text1.Text = ""
  296.     If (News1.Blocking) Then
  297.         News1_Done 0
  298.     End If
  299. End Sub
  300. Private Sub cmdGetAllGroups_Click()
  301.     Dim i As Integer
  302.     state = StateGetGroups
  303.     EnableControls False
  304.     listGroups.Clear
  305.     groupIndex = 0
  306.     News1.Action = NewsGetAllGroups
  307.     If (News1.Blocking) Then
  308.         News1_Done 0
  309.     End If
  310. End Sub
  311. Private Sub cmdGetNewGroups_Click()
  312.     state = StateGetGroups
  313.     '
  314.     ' A real newsreader would keep track of the last
  315.     ' time the news groups were updated and supply an
  316.     ' appropriate date here
  317.     '
  318.     News1.Date = Format("04/30/1996 00:00:00", "ddd, dd mmm yyyy hh:mm:ss")
  319.     EnableControls False
  320.     listGroups.Clear
  321.     groupIndex = 0
  322.     News1.Action = NewsGetNewGroups
  323.     If (News1.Blocking) Then
  324.         News1_Done 0
  325.     End If
  326. End Sub
  327. Private Sub cmdNewArticle_Click()
  328.     PostArticle False
  329. End Sub
  330. Private Sub cmdReply_Click()
  331.     PostArticle True
  332. End Sub
  333. Sub PostArticle(reply As Boolean)
  334.     Dim i As Integer
  335.     Dim j As Integer
  336.     Dim s As String
  337.     Dim body As String
  338.     '
  339.     ' Set user info from e-mail address
  340.     '
  341.     i = InStr(m_emailaddr, "@")
  342.     j = InStr(m_emailaddr, "(") - 1
  343.     News1.EMailAddress = m_emailaddr
  344.     News1.PostingHost = Mid(m_emailaddr, i + 1, j - i - 1)
  345.     '
  346.     ' Add optional headers
  347.     '
  348.     News1.HeadersCount = 0
  349.     News1.Headers(0) = "Organization: Mabry Software http://www.mabry.com"
  350.     News1.Headers(1) = "X-Newsreader: Mabry News Reader Sample Project"
  351.     News1.Headers(2) = "X-Information1: Mabry Software develops ActiveX controls"
  352.     News1.Headers(3) = "X-Information2: This post was generated by a client using Mabry's News ActiveX Control"
  353.     '
  354.     ' If this is a reply message
  355.     '
  356.     If (reply) Then
  357.         '
  358.         ' Set references line
  359.         '
  360.         s = News1.References & " " & News1.ArticleID
  361.         Do While (Len(s) > 512)
  362.             i = InStr(s, "> <")
  363.             If (i = 0) Then
  364.                 ' This should never happen ... but
  365.                 Exit Do
  366.             End If
  367.             s = Right(s, Len(s) - (i + 1))
  368.         Loop
  369.         News1.References = s
  370.         '
  371.         ' Set groups and subject
  372.         '
  373.         NewMessage.NewsGroups.Text = News1.NewsGroups
  374.         If (StrConv(Left(News1.Subject, 3), vbLowerCase) <> "re:") Then
  375.             NewMessage.Subject.Text = "Re: " & News1.Subject
  376.         Else
  377.             NewMessage.Subject.Text = News1.Subject
  378.         End If
  379.         '
  380.         ' Quote body text in reply
  381.         '
  382.         s = News1.BodyText
  383.         body = News1.From & " wrote:" & vbCrLf
  384.         Do While (s <> "")
  385.             body = body & ">" & Left(s, InStr(s, Chr(13)) + 1)
  386.             s = Right(s, Len(s) - (InStr(s, Chr(13)) + 1))
  387.         Loop
  388.         NewMessage.body.Text = body
  389.     Else
  390.         '
  391.         ' New message
  392.         '
  393.         NewMessage.NewsGroups.Text = News1.group
  394.         NewMessage.Subject.Text = ""
  395.         News1.References = ""
  396.     End If
  397.     Flag.Value = 0
  398.     NewMessage.Show 1
  399.     If (Flag.Value = 0) Then
  400.         Exit Sub
  401.     End If
  402.     News1.ArticleID = Format(Now(), "ddmmyyhhmmss") & "@" & News1.PostingHost
  403.     News1.Date = Format(Now(), "ddd, dd mmm yyyy hh:mm:ss ") & "-0700"
  404.     News1.PostArticle
  405. End Sub
  406. Private Sub cmdCancelMsg_Click()
  407.     Dim i As Integer
  408.     Dim j As Integer
  409.     i = InStr(m_emailaddr, "@")
  410.     j = InStr(m_emailaddr, "(") - 1
  411.     News1.EMailAddress = m_emailaddr
  412.     News1.PostingHost = Mid(m_emailaddr, i + 1, j - i - 1)
  413.     News1.HeadersCount = 0
  414.     News1.Subject = "cmsg cancel " & News1.ArticleID
  415.     News1.NewsGroups = News1.NewsGroups & ",control.cancel"
  416.     News1.Headers(0) = "Control: cancel " & News1.ArticleID
  417.     News1.ArticleID = Format(Now(), "ddmmyyhhmmss") & "@" & News1.PostingHost
  418.     News1.Date = Format(Now(), "ddd, dd mmm yyyy hh:mm:ss ") & "-0700"
  419.     News1.References = ""
  420.     News1.BodyText = ""
  421.     News1.PostArticle
  422. End Sub
  423. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  424. ' News Control Events
  425. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  426. Private Sub News1_AsyncError(ByVal ErrorCode As Long, ByVal Description As String)
  427.     MsgBox "AsyncError: " & Description
  428.     EnableControls True
  429. End Sub
  430. Private Sub News1_DataReady()
  431.     Select Case state
  432.         Case StateGetGroups
  433.             AddGroupsToList groupIndex
  434.     End Select
  435. End Sub
  436. Private Sub News1_Debug(ByVal Text As String)
  437.     If (Check2.Value <> 0) Then
  438.         Debug.Print Text
  439.     End If
  440. End Sub
  441. Private Sub News1_Done(ByVal ErrorCode As Integer)
  442.     Dim i As Integer
  443.     Select Case state
  444.         Case StateConnecting
  445.             If (ErrorCode = 0) Then
  446.                 state = StateConnected
  447.             End If
  448.             EnableControls True
  449.         Case StateDisconnecting
  450.             state = StateDisconnected
  451.             EnableControls True
  452.         Case StateGetArticleIDs
  453.             state = StateConnected
  454.             articleIndex = 0
  455.             ListHeaders
  456.         Case StateGetGroups
  457.             AddGroupsToList groupIndex
  458.             state = StateConnected
  459.             EnableControls True
  460.         Case StateSelectGroup
  461.             '
  462.             ' Just finished selecting a group, get the article ids
  463.             '
  464. ' Use this code if the xover command isn't
  465. ' supported for the connected server
  466. '            state = StateGetArticleIDs
  467. '            listArticles.Clear
  468. '            News1.Date = Format("05/22/1996 12:00:00", "ddd, dd mmm yyyy hh:mm:ss")
  469. '            articleIndex = 0
  470. '            News1.GetNewNews
  471.             Flag.Value = 0
  472.             
  473.             msgrange.First.Text = News1.FirstArticle
  474.             msgrange.Last.Text = News1.LastArticle
  475.             msgrange.Show 1
  476.             If (Flag.Value = 0) Then
  477.                 state = StateConnected
  478.                 EnableControls True
  479.                 Exit Sub
  480.             End If
  481. ''''''''''''''''''''''
  482. ' cut this code for non-xover servers
  483.             state = StateXOver
  484.             News1.Action = NewsXover
  485. ' end cut
  486. ''''''''''''''''''''''
  487.             If (News1.Blocking) Then
  488.                 ListHeaders
  489.                 state = StateConnected
  490.                 EnableControls True
  491.             End If
  492.         Case StateGetArticle
  493.             state = StateConnected
  494.             EnableControls True
  495.             If (ShowHeaders.Checked) Then
  496.                 Text1.Text = News1.HeaderText & Chr$(13) & Chr$(10) & News1.BodyText
  497.             Else
  498.                 Text1.Text = News1.BodyText
  499.             End If
  500.         Case StateGetHeader
  501.             listArticles.AddItem News1.Subject
  502.             ListHeaders
  503.         Case StateXOver
  504.             ListHeaders
  505.             state = StateConnected
  506.             EnableControls True
  507.         Case Else
  508.             state = StateConnected
  509.             EnableControls True
  510.     End Select
  511. End Sub
  512. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  513. ' Form
  514. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  515. Private Sub FileExit_Click()
  516.     End
  517. End Sub
  518. Private Sub Form_Load()
  519.     state = StateDisconnected
  520.     EnableControls True
  521.     News1.Host = "msnews.microsoft.com"
  522.     News1.LogonName = ""
  523.     News1.LogonPassword = ""
  524.     Me.Show
  525.     SetPopupPos UserInfo
  526.     UserInfo.Show 1
  527. End Sub
  528. Private Sub Form_Resize()
  529.     Line1.X2 = Me.ScaleWidth
  530.     Line2.X2 = Me.ScaleWidth
  531.     Line3.X2 = Me.ScaleWidth
  532.     cmdVSplit.Height = cmdHSplit.Top - Line2.Y2 - 1
  533.     cmdHSplit.Width = Me.ScaleWidth
  534.     listGroups.Top = Line2.Y1 + Margin
  535.     listGroups.Height = cmdHSplit.Top - Line2.Y1 - Margin * 2
  536.     listGroups.Left = Margin
  537.     listGroups.Width = cmdVSplit.Left - Margin * 2
  538.     listArticles.Top = Line2.Y1 + Margin
  539.     listArticles.Height = cmdHSplit.Top - Line2.Y1 - Margin * 2
  540.     listArticles.Left = cmdVSplit.Left + cmdVSplit.Width + Margin
  541.     listArticles.Width = Me.ScaleWidth - listArticles.Left - Margin
  542.     Text1.Top = cmdHSplit.Top + cmdHSplit.Height + Margin
  543.     Text1.Height = Me.ScaleHeight - (cmdHSplit.Top + cmdHSplit.Height) - Margin * 2
  544.     Text1.Left = Margin
  545.     Text1.Width = Me.ScaleWidth - Margin * 2
  546. End Sub
  547. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  548. ' Menus
  549. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  550. Private Sub SettingsConnection_Click()
  551.     SetPopupPos ConnectionOptionsForm
  552.     ConnectionOptionsForm.Show 1
  553. End Sub
  554. Private Sub SettingsUser_Click()
  555.     SetPopupPos UserInfo
  556.     UserInfo.Show 1
  557. End Sub
  558. Private Sub ShowHeaders_Click()
  559.     ShowHeaders.Checked = Not ShowHeaders.Checked
  560.     If (ShowHeaders.Checked) Then
  561.         Text1.Text = News1.HeaderText & Chr$(13) & Chr$(10) & News1.BodyText
  562.     Else
  563.         Text1.Text = News1.BodyText
  564.     End If
  565. End Sub
  566. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  567. ' List Boxes
  568. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  569. Private Sub listGroups_DblClick()
  570.     News1.group = listGroups.List(listGroups.ListIndex)
  571.     News1.NewsGroups = News1.group
  572.     state = StateSelectGroup
  573.     EnableControls False
  574.     News1.SelectGroup
  575.     listArticles.Clear
  576.     If (News1.Blocking) Then
  577.         News1_Done 0
  578.     End If
  579. End Sub
  580. Private Sub listArticles_DblClick()
  581. ' Use this code for non-xover servers
  582. '    News1.ArticleID = News1.ArticleIDs(listArticles.ListIndex)
  583. ' cut here for non-xover servers
  584.     News1.ArticleID = listArticles.ItemData(listArticles.ListIndex)
  585. ' end cut
  586.     state = StateGetArticle
  587.     EnableControls False
  588.     News1.GetArticle
  589.     If (News1.Blocking) Then
  590.         News1_Done 0
  591.     End If
  592. End Sub
  593. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  594. ' Splitters
  595. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  596. Private Sub cmdHSplit_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  597.     Dim oldy As Integer
  598.     Dim newy As Integer
  599.     Y = Y / Screen.TwipsPerPixelY
  600.     oldy = cmdHSplit.Top
  601.     newy = Y + cmdHSplit.Top - (cmdHSplit.Height / 2)
  602.     If (newy = oldy) Then
  603.         Exit Sub
  604.     End If
  605.     If (Button) Then
  606.         cmdHSplit.Top = newy
  607.         listGroups.Height = cmdHSplit.Top - listGroups.Top - Margin
  608.         listArticles.Height = listGroups.Height
  609.         Text1.Top = cmdHSplit.Top + cmdHSplit.Height + Margin
  610.         Text1.Height = Me.ScaleHeight - (cmdHSplit.Top + cmdHSplit.Height) - Margin * 2
  611.         cmdVSplit.Height = cmdHSplit.Top - Line2.Y2 - 1
  612.     End If
  613. End Sub
  614. Private Sub cmdHSplit_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  615.     If (listGroups.Enabled) Then
  616.         listGroups.SetFocus
  617.     End If
  618. End Sub
  619. Private Sub cmdVSplit_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  620.     Dim oldx As Integer
  621.     Dim newx As Integer
  622.     X = X / Screen.TwipsPerPixelX
  623.     oldx = cmdVSplit.Left
  624.     newx = X + cmdVSplit.Left - (cmdVSplit.Width / 2)
  625.     If (newx = oldx) Then
  626.         Exit Sub
  627.     End If
  628.     If (Button) Then
  629.         cmdVSplit.Left = newx
  630.         listGroups.Width = cmdVSplit.Left - listGroups.Left - Margin
  631.         listArticles.Left = cmdVSplit.Left + Margin + cmdVSplit.Width
  632.         listArticles.Width = Me.ScaleWidth - listArticles.Left - 2 * Margin
  633.     End If
  634. End Sub
  635. Private Sub cmdVSplit_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  636.     If (listGroups.Enabled) Then
  637.         listGroups.SetFocus
  638.     End If
  639. End Sub
  640. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  641. ' Misc Subs
  642. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  643. Private Sub EnableControls(fEnable As Boolean)
  644.     If (fEnable = False) Then
  645.         cmdConnect.Enabled = fEnable
  646.         cmdDisconnect.Enabled = fEnable
  647.         cmdGetAllGroups.Enabled = fEnable
  648.         cmdGetNewGroups.Enabled = fEnable
  649.         cmdNewArticle.Enabled = fEnable
  650.         cmdReply.Enabled = fEnable
  651.         cmdCancelMsg.Enabled = fEnable
  652.         listGroups.Enabled = fEnable
  653.         listArticles.Enabled = fEnable
  654.     ElseIf (state = StateConnected) Then
  655.         cmdConnect.Enabled = False
  656.         cmdDisconnect.Enabled = True
  657.         cmdGetAllGroups.Enabled = True
  658.         cmdGetNewGroups.Enabled = True
  659.         cmdNewArticle.Enabled = True
  660.         cmdReply.Enabled = True
  661.         cmdCancelMsg.Enabled = True
  662.         If (listGroups.ListCount > 0) Then
  663.             listGroups.Enabled = True
  664.         Else
  665.             listGroups.Enabled = False
  666.         End If
  667.         If (listArticles.ListCount > 0) Then
  668.             listArticles.Enabled = True
  669.         Else
  670.             listArticles.Enabled = False
  671.         End If
  672.     Else
  673.         cmdConnect.Enabled = True
  674.         cmdDisconnect.Enabled = False
  675.         cmdGetAllGroups.Enabled = False
  676.         cmdGetNewGroups.Enabled = False
  677.         cmdNewArticle.Enabled = False
  678.         cmdReply.Enabled = False
  679.         cmdCancelMsg.Enabled = False
  680.         listGroups.Enabled = False
  681.         listArticles.Enabled = False
  682.     End If
  683. End Sub
  684. Sub AddGroupsToList(i As Integer)
  685.     Dim group As String
  686.     Do While (i < News1.GroupCount)
  687.         group = News1.Groups(i)
  688.         group = Left$(group, InStr(group, " ") - 1)
  689.         listGroups.AddItem group
  690.         i = i + 1
  691.     Loop
  692. End Sub
  693. Sub ListHeaders()
  694. '''''''''''''''''
  695. ' cut here for non-xover servers
  696.     Dim i As Integer
  697.     Dim s As String
  698.     Dim n As Long
  699.     For i = 0 To News1.XOverHeadersCount - 1
  700.         s = News1.XOverHeaders(i)
  701.         n = Val(Left(s, InStr(s, Chr(9)) - 1))
  702.         s = Right(s, Len(s) - InStr(s, Chr(9)))
  703.         s = Left(s, InStr(s, Chr(9)))
  704.         listArticles.AddItem s
  705.         listArticles.ItemData(i) = n
  706.     Next
  707. ' end cut
  708. '''''''''''''''''
  709. ' Use this code for non-xover servers
  710. ' Note: Getting individual headers is a whole lot slower than using
  711. ' xover.
  712. '    If (News1.Blocking) Then
  713. '        Do While articleIndex < News1.ArticleIDsCount
  714. '            News1.ArticleID = News1.ArticleIDs(articleIndex)
  715. '            News1.GetHeader
  716. '            listArticles.AddItem News1.Subject
  717. '            articleIndex = articleIndex + 1
  718. '            DoEvents
  719. '        Loop
  720. '    Else
  721. '        If (articleIndex < News1.ArticleIDsCount) Then
  722. '            News1.ArticleID = News1.ArticleIDs(articleIndex)
  723. '            articleIndex = articleIndex + 1
  724. '            state = StateGetHeader
  725. '            News1.GetHeader
  726. '        Else
  727. '            EnableControls True
  728. '            state = StateNone
  729. '        End If
  730. '    End If
  731. End Sub
  732. Sub SetPopupPos(foo As Form)
  733.     foo.Top = Me.Top + Me.Height / 5
  734.     foo.Left = Me.Left + (Me.Width - foo.Width) / 2
  735. End Sub
  736.